<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    
    <body>
        
        <ui:composition template="./template.xhtml">
            
            <ui:define name="content">
                 <h:form>
                    <table border="0" width="100%">
                        <thead>
                            <tr>
                                <th>Name</th>
                            </tr>
                        </thead>
                        <tbody>
                            <c:forEach items="#{coursesBean.list}" var="c">
                                <tr>
                                    <td><h:outputText value="#{c.cname}"></h:outputText></td>
                                    <td>
                                        <a href="editcourse.xhtml?id=#{c.cid}">Edit</a>&nbsp;
                                        <h:commandLink onclick="if (!confirm('Are you sure you want to delete the current record?'))return false" value="Delete" action="#{coursesBean.delete(c)}"></h:commandLink>
                                    </td>
                                </tr>
                            </c:forEach>
                        </tbody>
                    </table>
                </h:form>

            </ui:define>

        </ui:composition>
        
    </body>
</html>
